import { request } from "@/utils/http";
import type { SetHospitalInfo, Records } from "./model/types";

//获取医院设置列表数据
export const getSetHospitalInfo = (
  page: number,
  limit: number,
  data?: { hosname?: string; hoscode?: string }
) =>
  request.get<any, SetHospitalInfo>(
    `/admin/hosp/hospitalSet/${page}/${limit}`,
    { params: data }
  );

//添加医院
export const addHospital = (data: Records) =>
  request.post<any, null>("/admin/hosp/hospitalSet/save", data);

//删除医院
export const removeHospital = (id: number) =>
  request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`);

//修改医院
export const updateHospital = (data: Records) =>
  request.put<any, null>(`/admin/hosp/hospitalSet/update`, data);

//修改医院获取的医院数据
export const getUpdateHospital = (id: string) =>
  request.get<any, SetHospitalInfo>(`/admin/hosp/hospitalSet/get/${id}`);

//批量删除医院
export const deleteBatchHospital = (idList: React.Key[]) =>
  request.delete<any, null>("/admin/hosp/hospitalSet/batchRemove", {
    data: idList,
  });
